package com.suredy.app.porject.export.model;

/**
 * 完工项目毛利率统计模型
 * 
 * @author VIVID.G
 * @since 2016-2-29
 * @version v0.1
 */
public class CompletedContractLRModel {

	/* 项目编号 */
	private String no;

	/* 合同名称 */
	private String name;

	/* 实际工期 */
	private String gongQi;

	/* 建设单位 */
	private String companyA;

	/* 完工情况 */
	private String completed;

	/* 合同金额 */
	private Double price;

	/* 合同金额文字描述 */
	private String priceString;

	/* 结算价（金额） */
	private Double jsPrice;

	/* 任务书（金额） */
	private Double taskPrice;

	/* 分包（金额） */
	private Double subPrice;

	/* 材料费（金额） */
	private Double materialPrice;

	/* 其他费用（金额） */
	private Double otherPrice;

	/* 项目负责人 */
	private String header;

	/* 实施单位 */
	private String companyB;

	/* 备注 */
	private String remark;

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getGongQi() {
		return gongQi;
	}

	public void setGongQi(String gongQi) {
		this.gongQi = gongQi;
	}

	public String getCompanyA() {
		return companyA;
	}

	public void setCompanyA(String companyA) {
		this.companyA = companyA;
	}

	public String getCompleted() {
		return completed;
	}

	public void setCompleted(String completed) {
		this.completed = completed;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getPriceString() {
		return priceString;
	}

	public void setPriceString(String priceString) {
		this.priceString = priceString;
	}

	public Double getJsPrice() {
		return jsPrice;
	}

	public void setJsPrice(Double jsPrice) {
		this.jsPrice = jsPrice;
	}

	public Double getTaskPrice() {
		return taskPrice;
	}

	public void setTaskPrice(Double taskPrice) {
		this.taskPrice = taskPrice;
	}

	public Double getSubPrice() {
		return subPrice;
	}

	public void setSubPrice(Double subPrice) {
		this.subPrice = subPrice;
	}

	public Double getMaterialPrice() {
		return materialPrice;
	}

	public void setMaterialPrice(Double materialPrice) {
		this.materialPrice = materialPrice;
	}

	public Double getOtherPrice() {
		return otherPrice;
	}

	public void setOtherPrice(Double otherPrice) {
		this.otherPrice = otherPrice;
	}

	public String getHeader() {
		return header;
	}

	public void setHeader(String header) {
		this.header = header;
	}

	public String getCompanyB() {
		return companyB;
	}

	public void setCompanyB(String companyB) {
		this.companyB = companyB;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * 毛利
	 * 
	 * @return
	 */
	public double getLr() {
		Double p = this.getJsPrice();

		if (p == null)
			p = this.getPrice();

		if (p == null)
			p = 0d;

		double task = this.getTaskPrice() == null ? 0d : this.getTaskPrice();
		double sub = this.getSubPrice() == null ? 0d : this.getSubPrice();
		double material = this.getMaterialPrice() == null ? 0d : this.getMaterialPrice();
		double other = this.getOtherPrice() == null ? 0d : this.getOtherPrice();

		return p - task - sub - material - other;
	}

	/**
	 * 毛利率
	 * 
	 * @return
	 */
	public double getLrRatio() {

		Double p = this.getJsPrice();

		if (p == null)
			p = this.getPrice();

		if (p == null || p == 0d)
			p = 1d;

		return this.getLr() / p;
	}

}
